<template>
<!-- 时间轴   -->
  <div class="d-flex px-10 m-t30">
    <div v-if="state.list.length>0" class="item-wrap d-flex flex-column" v-for="(item,index) in state.list" :key="index">
        <span class="m-b20 timeName m-l10">{{item.timeName}}</span>
        <div class="line m-l10 m-r10"></div>
        <span class="m-t10 time">{{item.startTime}}-{{item.endTime || '0000-00-00 00:00:00'}}</span>
        <span class="time m-t10">{{item.userName}}</span>
    </div>
    <el-empty v-else description="暂无数据" />
  </div>
  <div class="button-wrap d-flex a-center j-center m-t20">
      <el-button class="button_cancel" @click="goBack">返回</el-button>
  </div>
</template>

<script setup>
import {useRouter} from "vue-router";
import {investmentProjects} from "@/api/investment";
import {reactive} from "vue";
import {ElEmpty} from "element-plus";

const router = useRouter();
const projectId  = router.currentRoute.value.params.projectId;
const state = reactive({
    list:[]
});

/**
 * 获取时间轴数据
 */
const getProjectTime = (projectId,callback) => {
    investmentProjects.getProjectTime(projectId).then(res=>{
      if(res.code === '200'){
          if(callback)callback();
          state.list = res.data;
      }
    });
}

/**
 * 返回
 */
const goBack = () => {
    router.push({path:`/investmentProjectManagement/investmentProjects/investmentProjectInformation/investmentProjectsList`});
}

/**
 * 获取数据
 */
const getData = (callback) => {
    getProjectTime(projectId,callback);
}

defineExpose({getData});
</script>

<style lang="scss" scoped>
.item-wrap{
  .timeName{
    font-size: 14px;
    font-family: SourceHanSansCN-Normal, SourceHanSansCN;
    font-weight: 400;
    color: #000000;
  }
  .line::before{
    position: absolute;
    top: -3px;
    right: -12px;
    display: block;
    content: ' ';
    width: 6px;
    height: 6px;
    background: #FC7018;
    border-radius: 50%;
  }
  .line{
    position: relative;
    width: 224px;
    height: 2px;
    background-color: #FC7018;
  }
  .time{
    font-size: 14px;
    font-family: SourceHanSansCN-Normal, SourceHanSansCN;
    font-weight: 400;
    color: #000000;
  }
}
</style>
